﻿using System;
using System.Collections.Generic;
using System.Text;
using Kugar.Core.ExtMethod;

namespace Kugar.UI.Web.AdminLTE.PageControls
{
    public class PageMenu
    {
        public PageMenu() { }

        public PageMenu(string title, string url="", string key = "",string iconCss= "fa-circle-o", string badge = "")
        {
            Title = title;
            GotoUrl = url;
            Key = key;
            Badge = badge;
            LogoCss = iconCss;
        }


        public string LogoCss { set; get; }

        public string Title { set; get; }

        public string Key { set; get; }

        public string GotoUrl { set; get; }

        public bool Hide { set; get; } = false;

        public string Badge { set; get; }
        

        internal string ParentKey { set; get; }



        public PageMenu[] ChildMenus { set; get; }

        

        public bool IsShow
        {
            get
            {
                if (Hide)
                {
                    return false;
                }
                else
                {
                    if (ChildMenus.HasData())
                    {
                        foreach (var menu in ChildMenus)
                        {
                            if (menu.IsShow)
                            {
                                return true;
                            }
                        }

                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
            }
        }

    }
}
